package com.qumitech.visualnovel.controller.rest;

import com.qumitech.visualnovel.model.common.BaseRsp;
import com.qumitech.visualnovel.pubdef.dto.voiceroom.VoiceRoomSplitFlowCfgDTO;
import com.qumitech.visualnovel.service.voiceRoom.VoiceRoomSplitFlowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/voiceroom/split/flow")
public class VoiceRoomSplitFlowController {
    @Autowired
    private VoiceRoomSplitFlowService splitFlowService;

    @PostMapping("/cfg")
    public BaseRsp saveSplitFlowCfg(@RequestBody VoiceRoomSplitFlowCfgDTO cfgDTO){
        return splitFlowService.saveSplitFlowCfg(cfgDTO);
    }

    @DeleteMapping("/cfg/id/{id}")
    public BaseRsp rmSplitFlowCfg(@PathVariable("id") long id){
        return splitFlowService.rmSplitFlowCfg(id);
    }

    @GetMapping("/cfg")
    public BaseRsp listSplitFlowCfg(@RequestParam(value = "split_flow_short_id", required = false) String splitFlowShortId){
         return splitFlowService.listSplitFlowCfg(splitFlowShortId);
    }
}
